<table id="show_impeachuser"></table>
<script type="text/javascript">
$(function(){
	$('#show_impeachuser').datagrid({
		url:'impeachuser.action',
		queryParams:{op:'findbypage'},//查询参数   传入参数  默认查询可用账号信息
		pagination:true,
		singleSelect:true,
		pageList:[3,6,10,13,17],
		pageSize:6,
		toolbar: [{
			iconCls: 'icon-search',
			handler: function(){
				//点击当前图标查询禁用 用户信息
				$('#show_impeachuser').datagrid('load',{
					op:'findbypage',
					ui_state:'1'
				});
			}
		}],
		columns:[[
			{field:'ui_id',title:'编号',width:100},
			{field:'ui_uid',title:'举报人ID',width:100},
			{field:'ui_uname',title:'举报人姓名',width:100,align:'right'},
			{field:'ui_rid',title:'被举报人ID',width:100,align:'right'},
			{field:'ui_rname',title:'被举报人姓名',width:100,align:'right'},
			{field:'ui_reason',title:'举报原因',width:100,align:'right'},
			{field:'ui_state',title:'处理进度',width:100,align:'right',
				formatter:function(value,row,index){
					if(1==row.ui_state){
						return '待处理';
					}else if(2==row.ui_state){
						return '已封禁';
					}else if(3==row.ui_state){
						return '已驳回';
					}
				}
			},
			{field:'a_option',title:'操作',width:150,
				formatter:function(value,row,index){
					if(1==row.ui_state){
						var a = '<a href="javascript:void(0)" onclick="doReport('+row.ui_rid+','+row.ui_id+',1)">封禁用户</a>';
						var b = '<a href="javascript:void(0)" onclick="doReport('+row.ui_rid+','+row.ui_id+',2)">驳回</a>';
						return a+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+b;
					}else{
						var a='<a href="javascript:void(0)">无操作</a>';
						return a;
					}
				}
			}
		]]
	});
});
function doReport(uirid,uiid,dowhat){
	$.post('impeachuser.action',{op:'updatestate',ui_id:uiid,ui_rid:uirid,dowhat:dowhat},function(data){
		if(1==data){
			$('#show_impeachuser').datagrid('reload');
			$.messager.show({
				title:'举报提示',
				msg:'操作成功',
				timeout:3000,
				showType:'slide'
			});
		}else if(2==data){
			$.messager.show({
				title:'举报提示',
				msg:'操作失败',
				timeout:3000,
				showType:'slide'
			});
		}
	});
}
</script>